<?php
/*
  $Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $

  E-Commerce Solutions

  Copyright (c) 2005 www.flash-template-design.com

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

  $error = false;
  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
    $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
    $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

    if (tep_validate_email($email_address)) {
      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

      tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
    } else {
      $error = true;

      $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php require('includes/html_head.php'); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
	
<!-- body //-->
<tr>
	<td width="203" align="right" valign="top" style="padding-right:1px; ">
		<table width="203" cellpadding="0" cellspacing="0" border="0">
			<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
		</table>
	</td>
	<td width="410" valign="top" align="left" style="padding-left:1px;padding-right:1px;">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" >
			<tr>
				    <td width="100%" valign="top" height="141" align="left" style="padding-bottom:2px; "><img src="images/banner.jpg" width="410" height="141" alt="" /></td>
			</tr>
			<tr>
				<td height="27" width="350" align="left" bgcolor="#DDD0A8" ><p style="color:#FFFFFF; font-family:Tahoma, Helvetica, sans-serif; font-size:16px; padding-left:5px;"><?php echo HEADING_TITLE; ?></p></td>
  			</tr>
			<tr>
	            <td ><?php echo tep_draw_separator('pixel_trans.gif', '100%', '2'); ?></td>
          	</tr>	
      		<tr>
        		<td valign="top">
					<table width="100%" height="354" cellspacing="0" cellpadding="0" border="0" class="infoBox">
					<?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?>
<?php
  if ($messageStack->size('contact') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('contact'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
	 
<?php
  }

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
      <tr>
	  	<td valign="top">
		<table border="0" width="100%" cellspacing="0" cellpadding="0" >
	  <tr>
        <td class="main" valign="TOP"  align="center"><?php echo TEXT_SUCCESS; ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td valign="TOP"  align="left"><table border="0" width="100%" cellspacing="1" cellpadding="2" >
          <tr class="infoBoxContents">
            <td valign="TOP" ><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
	   </table></td>
      </tr>
<?php
  } else {
?>
      <tr>
        <td align="left">
          <table border="0" width="100%" cellspacing="6" cellpadding="2" >
            <tr>
                <td class="main" valign="top" width="60px"><?php echo ADDRESS_LABEL; ?></td>
                <td class="main" valign="top"><?php echo ADDRESS_TEXT; ?></td>
            </tr>
            <tr>
                <td class="main" valign="top"><?php echo EMAIL_LABEL; ?></td>
                <td class="main" valign="top"><?php echo EMAIL_TEXT; ?></td>
            </tr>
            <tr>
                <td class="main" valign="top"><?php echo PHONE_LABEL; ?></td>
                <td class="main" valign="top"><?php echo PHONE_TEXT; ?></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td style="padding-top:20px;">
          <table border="0" width="100%" cellspacing="6" cellpadding="2">
            <tr>
              <td class="main"><?php echo SEND_MESSAGE; ?></td>
            </tr>
           </table>
         </td>
      </tr>
      <tr>
        <td align="left" ><table border="0" width="100%" cellspacing="1" cellpadding="2" >
          <tr class="infoBoxContents">
            <td style="padding:5px; " valign="TOP" ><table border="0" width="100%" cellspacing="0" cellpadding="2" style="table-layout: fixed;">
              <tr>
                <td class="main"><?php echo ENTRY_NAME; ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo tep_draw_input_field('name'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_EMAIL; ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo tep_draw_input_field('email'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
              </tr>
              <tr>
                <td align="center">
                	<div style="padding-right: 5px;">
                		<?php echo tep_draw_textarea_field('enquiry', 'soft', '53', '11', '', 'style="width:100%"'); ?>
                	</div>
               	</td>
              </tr>
            </table></td>
          </tr>
		  <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" >
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                <td width="20"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
	   <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
        </table></td>
      </tr>
      
<?php
  }
?>
			
       
</table>
			 </form>
			</td>
		</tr>
	</table>	

<!-- body_text_eof //-->
		
      </td>
	<td width="185" valign="top" align="left">
					<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
	</table>
	</td>
 </tr>


<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
